<?php
$id				= gpc_getIntPost("id",$id);
$parentId       = gpc_getIntPost("ParentId");
$comment		= gpc_getStringPost("comment");
$comment        = str_replace("\n","<br>",$comment);
$comment		= replace_pathlocal($comment);

$AccountId      = getIdAdmin();
$account        = getAccountById($AccountId);
$fullname       = $account['cFullName'];
$Email          = $account['cEmail'];

$postdatetime   = gpc_getDateNow(true);
if($act=="insertcomment")
{
    $sql_insert = "INSERT INTO tblblog_comment
    	(iParentId,cFullName,cEmail,iAccountId,cContent,dPostDate,iStatus)
    VALUES
    	($parentId,'$fullname','$Email', '$AccountId','$comment','$postdatetime','1')";

    $dbsql->query($sql_insert);

	//Insert_Tracking("add comment : $name");
	page_transfer("Add comment Success !",$pagetr);
}
elseif($id>0)
{
	$sql_update = "UPDATE tblblog_comment SET
				cContent        = '$comment'
				WHERE iId= $id";

	$dbsql->query($sql_update);
    

	//Insert_Tracking(" Edit comment : $name");
	page_transfer("Update comment Success !",$pagetr);
}
exit();
?>
